var express = require('express');
var router = express.Router();
const saleModel = require('../models/saleModel');

router.get('/', async(req, res) =>{
    let result = await saleModel.find()
    res.send({
        code:1,
        msg:'查询数据成功',
        data:result,
      });
  })

  router.post('/',async(req, res) =>{
    let arr=req.body.list
    try {
      let result=await saleModel.insertMany(arr)
      console.log('删除结果',result);
      res.send({
        code:1,
        msg:'城市销售录入数据成功',
      });
    } catch (error) {
      res.send({
        code:0,
        msg:'城市销售录入失败',
        error,
      });
    }
  })
  module.exports = router;